﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="coupon_detail.aspx.cs" Inherits="Web.Admin.coupon_detail" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
        <link href="/css/DateTime.css" rel="stylesheet" type="text/css" />
     <script src="/js/datatime.js" type="text/javascript"></script>
     <script type="text/javascript">
        function checkFile(ele)
        {
            var fileName = ele.value;
            var pattern = /\.jpg$|\.jpeg$|\.gif$|\.png$|\.bmp$|\.mov$|\.mpeg$|\.mpg$|\.avi$|\.wmv$||\.rm$/gi;

            if(!pattern.test(fileName))
            {
                alert("文件格式不合规范！");
                return false;
            }
            else
            {
                return true;
            }
        }
</script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <a href="" id="aback" runat="server">返回 <asp:Label runat="server" ForeColor="Red" Font-Bold="true" ID="lblCorpName"></asp:Label>  商户优惠券列表</a>
       <p></p> 
        <asp:DetailsView ID="DetailsView1" runat="server" DataSourceID="odsCoupons" 
            AutoGenerateRows="False" AutoGenerateInsertButton="True" 
            DefaultMode="Insert" oniteminserted="DetailsView1_ItemInserted" 
            oniteminserting="DetailsView1_ItemInserting">
        <Fields>
            <asp:BoundField DataField="title" HeaderText="标题" />
            <asp:BoundField DataField="save" HeaderText="优惠" />
            <asp:TemplateField HeaderText="活动图片">
                <InsertItemTemplate>
                        <asp:FileUpload ID="FileUpload1" onchange="checkFile(this)" runat="server" />
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField  HeaderText="活动规则">
                <InsertItemTemplate>
        <input type="hidden" runat="server"  name="desc" id="desc" value='<%# Bind("desc") %>' /></p>
 &nbsp;<iframe src="../../Content/163editor/editor.html?id=DetailsView1_desc" frameborder="0" scrolling="no" width="400" height="240"></iframe>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="活动日期">
                <InsertItemTemplate>
                    <asp:TextBox ID="inDate" runat="server" onblur="showHint(this,1)" Style="width: 111px;
                color: #c1c1c1" onfocus="showHint(this,10,'outDate')" value="yyyy-mm-dd" Text='<%# Bind("btime") %>' name="inDate"></asp:TextBox>--
            <asp:TextBox ID="outDate" runat="server" onblur="showHint(this,1)" Style="width: 109px;
                color: #c1c1c1" onfocus="showHint(this)" value="yyyy-mm-dd" Text='<%# Bind("etime") %>' name="outDate"></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
        </Fields>
        </asp:DetailsView>
        <asp:ObjectDataSource ID="odsCoupons" runat="server" 
            OldValuesParameterFormatString="original_{0}" SelectMethod="SelectSingle" 
            TypeName="Model.couponsData" InsertMethod="Insert">
            <SelectParameters>
                <asp:QueryStringParameter Name="couponID" QueryStringField="id" Type="String" />
            </SelectParameters>
            <InsertParameters>
                <asp:Parameter Name="corpID" Type="String" />
                <asp:Parameter Name="imageSrc" Type="String" />
                <asp:Parameter Name="title" Type="String" />
                <asp:Parameter Name="btime" Type="String" />
                <asp:Parameter Name="etime" Type="String" />
                <asp:Parameter Name="desc" Type="String" />
                <asp:Parameter Name="save" Type="String" />
            </InsertParameters>
        </asp:ObjectDataSource>
        
    </div>
    </form>
</body>
</html>
